﻿using System.ComponentModel.DataAnnotations;
using System.Diagnostics.Contracts;
using WebAPI.Util;

namespace RapidSalesAdminPortalAPI.Models
{

    public class GetQrCodeUrlRequest
    { 
        public Guid SalePointId { get; set; }
    }

    public class AddSalesPointRequest
    {
        [Required(ErrorMessage = "Code is required")]
        public string Code { get; set; }


        [Required(ErrorMessage = "NameEn is required")]
        public string NameEn { get; set; } = null!;


        [Required(ErrorMessage = "NameTc is required")]
        public string NameTc { get; set; } = null!;


        [Required(ErrorMessage = "NameSc is required")]
        public string NameSc { get; set; } = null!;


        [Required(ErrorMessage = "DescriptionEn is required")]
        public string DescriptionEn { get; set; } = null!;


        [Required(ErrorMessage = "DescriptionTc is required")]
        public string DescriptionTc { get; set; } = null!;


        [Required(ErrorMessage = "DescriptionSc is required")]
        public string DescriptionSc { get; set; } = null!;
        public string? RapidSalesRemarksChi { get; set; }

        public string? RapidSalesRemarksTc { get; set; }
        public string? RapidSalesRemarksEng { get; set; }
        public string? RapidSalesThumbnailUrl { get; set; } 
        public DateTime RapidSalesStartDate { get; set; }
        public DateTime RapidSalesEndDate { get; set; }
        public bool ParentalGuidance { get; set; }
        public bool Exclusive { get; set; }
        public string? Passcode { get; set; }


        [Required(ErrorMessage = "OperationAreaID is required")]
        public Guid OperationAreaId { get; set; }

        public List<Guid>? ProductEventIds { get; set; }

        public bool Enable { get; set; }
    }

    public class GetSalesPointListRequest : BasePageInput
    {
        [MaxLength(200, ErrorMessage = "Code Max Length Error")]
        public string? Code { get; set; }
        [MaxLength(200, ErrorMessage = "Name Max Length Error")]
        public string? Name { get; set; }
        [MaxLength(250, ErrorMessage = "Description Max Length Error")]
        public string? Description { get; set; }
        public string? OperationArea { get; set; }
        public string? Enable { get; set; } = null;
    }

    public class GetSalesPointProductListResponse
    {
        public Guid ProductId { get; set; }
        public string? ProductCode { get; set; }
        public string? ProductName { get; set; }
        public string? Function { get; set; }
        public bool IsCheck { get; set; }
    }

    public class GetSalesPointProductRequest
    {
        public Guid SalePointId { get; set; }
        public string? ProductField { get; set; }
        public string? EventField { get; set; }
    }
    public class SalesPointByProductIdRequest
    {
        public Guid ProductId { get; set; }
        public string? Code { get; set; }
        public string? Name { get; set; }
    }

    public class GetSalesPointListResponse
    {
        public Guid Id { get; set; }
        public bool Exclusive { get; set; }
        public string Passcode { get; set; }
        public string Code { get; set; }
        public string NameEn { get; set; } = null!;
        public string NameTc { get; set; } = null!;
        public string NameSc { get; set; } = null!;
        public string DescriptionEn { get; set; } = null!;
        public string DescriptionTc { get; set; } = null!;
        public string DescriptionSc { get; set; } = null!;
        public Guid? OperationAreaId { get; set; }
        public bool HasProduct { get; set; }
        public string QrCodeUrl { get; set; } = null!;

        //public List<Guid> ProductEventIds { get; set; }
        public List<ProductEventInfo> ProductEventList { get; set; }
        public string OperationArea { get; set; }
        public bool Enable { get; set; }
        public string CreateUser { get; set; }
        public string CreateDate { get; set; }
        public string UpdateUser { get; set; }
        public string UpdateDate { get; set; }
    }

    public class ProductEventInfo
    { 
        public Guid ProductEventId { get; set; }
        public int CutOffTime { get; set; }
        public string? ProductName { get; set; }
        public string? EventName { get; set; }
        public bool IsExist { get; set; }
    }

    public class UpdateSalesPointRequest
    {
        [Required(ErrorMessage = "ID is required")]
        public Guid ID { get; set; }

        [Required(ErrorMessage = "Code is required")]
        public string Code { get; set; }

        [Required(ErrorMessage = "NameEn is required")]
        public string NameEn { get; set; } = null!;


        [Required(ErrorMessage = "NameTc is required")]
        public string NameTc { get; set; } = null!;


        [Required(ErrorMessage = "NameSc is required")]
        public string NameSc { get; set; } = null!;


        [Required(ErrorMessage = "DescriptionEn is required")]
        public string DescriptionEn { get; set; } = null!;


        [Required(ErrorMessage = "DescriptionTc is required")]
        public string DescriptionTc { get; set; } = null!;


        [Required(ErrorMessage = "DescriptionSc is required")]
        public string DescriptionSc { get; set; } = null!;

        [Required(ErrorMessage = "OperationAreaId is required")]
        public Guid OperationAreaId { get; set; }

        public bool Exclusive { get; set; }
        public string? Passcode { get; set; }
        //public List<Guid>? ProductEventIds { get; set; }
        public List<ProductEventInfo>? ProductEventList { get; set; }
        public bool Enable { get; set; }
    }

    public class DeleteSalesPointRequest
    {
        [Required(ErrorMessage = "ID is required")]
        public List<Guid> IDs { get; set; }
        [Required(ErrorMessage = "Enable is required")]
        public bool Enable { get; set; }
    }



    public class EnableSalesPointRequest
    {
        [Required(ErrorMessage = "IDs is required")]
        public string Ids { get; set; }

        public bool Enable { get; set; }

    }

    public class CheckExclusiveRequest
    {
        /// <summary>
        /// 语言标识
        /// </summary>
        [Required(ErrorMessage = "Language is required")]
        public int lang { set; get; }

        [Required(ErrorMessage = "SalesPoint Code is required")]
        public string SalesPointCode { get; set; }
    }
    public class CheckExclusiveResponse
    {
        public bool IsNeedCode { get; set; }
    }

    public class GetSalePointNameRequest
    {
        /// <summary>
        /// 语言标识
        /// </summary>
        [Required(ErrorMessage = "language is required")]
        public int lang { set; get; }

        [Required(ErrorMessage = "SalesPoint Code is required")]
        public string SalesPointCode { get; set; }
    }
    public class GetSalePointInfoResponse
    {
        public string ID { get; set; }
        public string Name { get; set; }
        public int maxQty { get; set; }
    }

    public class CheckCodeRequest
    {
        /// <summary>
        /// 语言标识
        /// </summary>
        [Required(ErrorMessage = "Language is required")]
        public int lang { set; get; }

        [Required(ErrorMessage = "SalesPoint Code is required")]
        public string SalesPointCode { get; set; }

        [Required(ErrorMessage = "Code is required")]
        public string Code { get; set; }
    }
    public class CheckCodeResponse
    {
        public bool IsOk { get; set; }
    }
}
